package com.thread.thread01;

/**
 * @version: java version 23
 * @Author: 韩学新
 * @description:
 * @date: 2025-03-24 下午7:58
 */
public class ThreadRunnable implements Runnable{
    @Override
    public void run() {
        try {
            Thread.sleep(3000);
            System.out.println(Thread.currentThread().getName() + "  is running");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

    }

    public static void main(String[] args) {
        System.out.println(Thread.currentThread().getName() + "  is running");
//
//        new Thread(new ThreadRunnable()).start();

        /**
         * 匿名内部类
         */

//        new Thread(new Runnable() {
//            @Override
//            public void run() {
//
//            }
//        });

        new Thread(() -> System.out.println(Thread.currentThread().getName() + "  is running"),"子线程").start();


    }

}
